package com.baseDemo.web.service.init;


import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import com.baseDemo.web.service.quartz.QuartzService;
import com.baseDemo.web.service.systeminfo.SystemInfoService;
/**
 * Spring 容器加载完成后  启动执行的任务  
 * @author xianwei
 *
 */
@Component
public class LoadDataCache implements ApplicationListener<ContextRefreshedEvent>   {
	private Logger logger = Logger.getLogger(getClass());
	@Resource
	private QuartzService quartzService;
	@Resource
	private SystemInfoService systemInfoService;

	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
		if(event.getApplicationContext().getParent()==null){
			logger.info("--系统初始化---");
			quartzService.init();
			systemInfoService.init();
			logger.info("--系统初始化完成---");
		}
	}


}
